<template xmlns="http://www.w3.org/1999/html">
 <div>
   <h1>视频上传</h1>
  <el-upload
    class="upload-demo"
    drag
    action="http://localhost:8088/video/addfile"
    :on-success="handleAvatarSuccess"
    multiple>
    <i class="el-icon-upload"></i>
    <div class="el-upload__text">将视频拖到此处，或<em>点击上传</em></div>
    <div class="el-upload__tip" slot="tip">只能上传MP4文件，且不超过100MB</div>
  </el-upload>
   <h1>视频版面图片上传</h1>
   <el-upload
     class="upload-demo"
     drag
     action="http://localhost:8088/video/addvideopic"
     :on-success="handleAvatarSuccesspic"
     multiple>
     <i class="el-icon-upload"></i>
     <div class="el-upload__text">将图片拖到此处，或<em>点击上传</em></div>
     <div class="el-upload__tip" slot="tip">只能上传jpg，jpng文件，且不超过10MB</div>
   </el-upload>
<h1>视频标题</h1>
    <el-input
      placeholder="请输入内容"
      v-model="VideoFile.vname"
      clearable>
    </el-input>
    <h1>价格</h1>
    <el-input
      placeholder="请输入价格"
      v-model="VideoFile.price"
      clearable>
    </el-input>
    <h1>选择上传形式</h1>
    <el-radio-group v-model="VideoFile.vid">
      <el-radio :label="1">自媒体</el-radio>
      <el-radio :label="2">个人</el-radio>
      <el-radio :label="3">转载</el-radio>
    </el-radio-group>
  <br></br>
    <el-button type="success" @click="addvideo" round>提交</el-button>
</div>



</template>

<script>
  import axios from "axios";
  export default {
    data() {

      return {
        VideoFile:{
          vaddress:'',
          vname:'',
          vid:'',
          price:'',
          pic:'',

        }

      }
    },
    methods: {

        handleAvatarSuccess(res) {

          this.VideoFile.vaddress = res;
          alert("视频上传成功")

        },
      handleAvatarSuccesspic(res) {

        this.VideoFile.pic = res;
        alert("图片上传成功")

      },
        addvideo(){
          axios.post('http://localhost:8088/video/addvideo',this.VideoFile).then(res=>{
            if(res.data.code==0) {
             this.$router.push("videoQAcode");
            }else {
              alert(res.data.message);
            }
          })

        }

    }
  }
  </script>




